package com.example.course.controller.admin;

import com.example.course.dto.admin.AdminCourseRemoveDto;
import com.example.course.dto.admin.AdminCourseSaveDto;
import com.example.course.dto.admin.AdminCourseUpdateDto;
import com.example.course.dto.admin.AdminCourseUpdateGetDto;
import com.example.course.dto.user.UserCourseListDto;
import com.example.course.service.CourseService;
import com.example.course.utils.common.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin/course")
public class AdminCourseController {

    @Autowired
    private CourseService courseService;

    @PostMapping("/save_course")
    public Result saveCourse(@RequestBody AdminCourseSaveDto dto){
        return courseService.saveCourse(dto);
    }

    @PostMapping("/remove_course")
    public Result removeCourse(@RequestBody AdminCourseRemoveDto dto){
        return courseService.removeCourse(dto);
    }

    @PostMapping("/get_course")
    public Result getCourse(@RequestBody UserCourseListDto dto){
        return courseService.getAdminCourseList(dto);
    }

    @PostMapping("/update_get_course")
    public Result updateGetCourse(@RequestBody AdminCourseUpdateGetDto dto){
        return courseService.updateGetCourse(dto);
    }

    @PostMapping("/update_course")
    public Result updateCourse(@RequestBody AdminCourseUpdateDto dto){
        return courseService.updateCourse(dto);
    }

}
